#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5+5;
int n,a[N],b[N];
namespace sub1{
	int ans[N];
	inline void main()
	{
		for(int i = 1;i<=n;i++) ans[i] = 2e18;
		for(int i = 1;i<=n;i++)
		{
			int mn1 = a[i],mn2 = b[i];
			for(int j = i;j<=n;j++)
				mn1 = min(mn1,a[j]),mn2 = min(mn2,b[j]),ans[j-i+1] = min(ans[j-i+1],abs(mn1-mn2));
		}
		for(int i = 1;i<=n;i++) cout<<ans[i]<<"\n";
	}
}
namespace sub2{
	inline void main()
	{
		int mn = a[1];
		for(int i = 2;i<=n;i++) mn = min(mn,a[i]);
		for(int i = 1;i<=n;i++) cout<<abs(b[i]-mn)<<'\n';
	}
}
namespace sub3{
	int stk[N],top,lt[N],rt[N],ans[N];
	inline void main()
	{
		stk[top = 0] = 0;
		for(int i = 1;i<=n;i++)
		{
			while(top&&a[stk[top]]>=a[i]) top--;
			lt[i] = stk[top];
			stk[++top] = i;
		}
		stk[top = 0] = n+1;
		for(int i = n;i;i--)
		{
			while(top&&a[stk[top]]>=a[i]) top--;
			rt[i] = stk[top];
			stk[++top] = i;	
		}
		for(int i = 1;i<=n;i++)
			ans[rt[i]-lt[i]-1] = max(ans[rt[i]-lt[i]-1],a[i]);
		for(int i = n;i;i--) ans[i] = max(ans[i+1],ans[i]);
		for(int i = 1;i<=n;i++) cout<<b[1]-ans[i]<<'\n';
	}
} 
signed main()
{
	freopen("min.in","r",stdin);
	freopen("min.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n;
	for(int i = 1;i<=n;i++)
		cin>>a[i];
	bool fl = 1;
	for(int i = 1;i<=n;i++)
		cin>>b[i],fl&=(b[i]==1);
	if(n<=1000) sub1::main();
	else if(fl) sub2::main();
	else sub3::main();
	return 0;
}

